package repository;


import dbConnect.dbConnecter;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.DriverManager;

public class ReleaseRepository {
    public ReleaseRepository(){

    }
    public boolean ReleaseNews(String headline,String name,String news_content)  throws SQLException {
        dbConnecter Con = new dbConnecter();
        Con.getConnection();
        String sql = "INSERT INTO news(Head,name,Content) VALUES ("+dbConnecter.toSql(headline)+","+dbConnecter.toSql(name)+","+dbConnecter.toSql(news_content)+")";
        try {
            int result = Con.resultSql(sql);
            if ( result> 0) {
                return true;
            } else return false;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            Con.close();
        }
    }
}